怎麼檢查 object 是不是空的?


Posted by Rich on 2021-09-12

有時候會有這種需求,這次解決的幫手是:

let obj = {}
if (Object.keys(obj).length === 0) //true

怕忘記,紀錄一下。










Related Posts

[Note] 網頁的構成要素

[Note] 網頁的構成要素

【JS 大魔王 - 1】閉包 Closure 與 Scope 作用域

【JS 大魔王 - 1】閉包 Closure 與 Scope 作用域

Let's AI 系列文整理

Let's AI 系列文整理


Comments